﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Invoice.aspx.cs" Inherits="Physio_Clinic.WebForm1" %>
<%@ Register assembly="Devart.Data.Linq.Web, Version=3.1.34.0, Culture=neutral, PublicKeyToken=09af7300eec23701" namespace="Devart.Data.Linq.Web" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% if (currentUser != null && currentUser.Username == "admin")
       {   
      %>
    <asp:Panel ID="Panel1" runat="server" Height="617px">
    <div>
        <br />
        ชื่อลูกค้า :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Label ID="CustomerName" runat="server" Text="Label"></asp:Label>
        <br />
        เลขที่ใบขายสินค้า:&nbsp;&nbsp; &nbsp;<asp:Label ID="OrderNumberText" runat="server" 
            Text="Label"></asp:Label>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; วันที่ออกเอกสาร:&nbsp;
        <asp:Label ID="DateRelease" runat="server" Text="Label"></asp:Label>
        <br />
        เลขใบกำกับภาษี:&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Label ID="TaxNumberText" runat="server" Text="Label"></asp:Label>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; วันที่ใบกำกับภาษี: 
        <asp:TextBox ID="TaxDateText" 
            runat="server" Width="151px"></asp:TextBox>
        <br />
    </div>
        รหัสบาร์โคดยา: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="BarcodeId" runat="server" ontextchanged="TextBox7_TextChanged" 
            Width="343px"></asp:TextBox>
&nbsp;
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
            Text="เพิ่มยา" Width="154px" />
        &nbsp;
        <br />
        การักษา:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:DropDownList ID="DropDownList2" runat="server" 
            DataSourceID="LinqDataSource1" DataTextField="DrugName" DataValueField="DrugId" 
            Height="26px" Width="346px">
        </asp:DropDownList>
        &nbsp;&nbsp;
        <asp:Button ID="Button6" runat="server" onclick="Button6_Click1" 
            Text="เพิ่มการักษา" Width="153px" />
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
            ContextTypeName="Physio10Context.Physio10DataContext" EntityTypeName="" 
            TableName="Drugs" Where="IsDrug == @IsDrug">
            <WhereParameters>
                <asp:Parameter DefaultValue="false" Name="IsDrug" Type="Boolean" />
            </WhereParameters>
        </asp:LinqDataSource>
        <br />
        <br />
        <br />
        <asp:Button ID="Button3" runat="server" Enabled="False" onclick="Button3_Click" 
            Text="เเก้ไข" Visible="False" />
        <asp:Button ID="Button4" runat="server" Enabled="False" onclick="Button4_Click" 
            Text="ลบ" Visible="False" />
        <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
            AutoGenerateColumns="False" BackColor="White" BorderColor="White" 
            BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" 
            DataKeyNames="DrugOrderDetail" DataSourceID="LinqDataSource" GridLines="None" 
            onselectedindexchanged="GridView1_SelectedIndexChanged" 
            RowHeaderColumn="BookId" ShowHeaderWhenEmpty="True" Width="709px" 
            onrowcommand="GridView1_RowCommand" onrowcreated="GridView1_RowCreated">
            <Columns>
                <asp:CommandField HeaderText="เลือก" SelectText="เลือก" 
                    ShowSelectButton="True" Visible="False" />
                <asp:ButtonField ButtonType="Button" CommandName="EditOrder" 
                    HeaderText="เเก้ไข" Text="เเก้ไข">
                <ItemStyle Width="20px" />
                </asp:ButtonField>
                <asp:ButtonField ButtonType="Button" CommandName="DeleteOrder" HeaderText="ลบ" 
                    ShowHeader="True" Text="ลบ">
                <ItemStyle Width="20px" />
                </asp:ButtonField>
                <asp:BoundField DataField="DrugOrderDetail" HeaderText="เลขที่" 
                    InsertVisible="False" ReadOnly="True" SortExpression="DrugOrderDetail" />
                <asp:BoundField DataField="ProductName" HeaderText="สินค้า" ReadOnly="True" 
                    SortExpression="ProductName">
                <ItemStyle Width="50%" />
                </asp:BoundField>
                <asp:BoundField DataField="Amount" HeaderText="จำนวน" SortExpression="Amount" />
                <asp:BoundField DataField="unit" HeaderText="หน่วยละ" ReadOnly="True" 
                    SortExpression="unit" />
                <asp:BoundField DataField="Discount" HeaderText="ส่วนลด" 
                    SortExpression="Discount" />
                <asp:BoundField DataField="Price" HeaderText="ราคา" ReadOnly="True" 
                    SortExpression="Price" />
                <asp:BoundField DataField="DrugOrderId" HeaderText="DrugOrderId" 
                    SortExpression="DrugOrderId" Visible="False" />
                <asp:BoundField DataField="DrugId" HeaderText="DrugId" SortExpression="DrugId" 
                    Visible="False" />
            </Columns>
            <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
            <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
            <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
            <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#594B9C" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#33276A" />
        </asp:GridView>
        <asp:LinqDataSource ID="LinqDataSource" runat="server" 
            ContextTypeName="Physio10Context.Physio10DataContext" EntityTypeName="" 
            TableName="Drugorderdetails" 
            Where="DrugOrderId == Convert.ToInt32(@DrugOrderId)" EnableDelete="True">
            <WhereParameters>
                <asp:SessionParameter Name="DrugOrderId" SessionField="orderId" Type="Int32" />
            </WhereParameters>
        </asp:LinqDataSource>
        &nbsp;
        
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> 
        
        <asp:Table ID="Table1" runat="server" 
            style="text-align: right; margin-left: 364px" Width="340px">
            <asp:TableRow runat="server">
                <asp:TableCell runat="server">รวมมูลค่าสินค้า</asp:TableCell>
                <asp:TableCell runat="server"><asp:Label ID="totalPrice" runat="server" Text="Label"></asp:Label></asp:TableCell>
                <asp:TableCell runat="server">บาท</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow runat="server">
                <asp:TableCell runat="server">ส่วนลด</asp:TableCell>
                <asp:TableCell runat="server"><asp:TextBox ID="DiscountTextbox" runat="server" 
            ontextchanged="DiscountTextbox_TextChanged" Width="72px"></asp:TextBox></asp:TableCell>
                <asp:TableCell runat="server"><asp:Button ID="Button5" runat="server" onclick="Button5_Click" Text="เเก้ไข" /></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow runat="server">
                <asp:TableCell runat="server">มูลค่าหักส่วนลด</asp:TableCell>
                <asp:TableCell runat="server"><asp:Label ID="totalPriceAfterDiscount" runat="server" Text="Label"></asp:Label></asp:TableCell>
                <asp:TableCell runat="server">บาท</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow runat="server">
                <asp:TableCell runat="server">ภาษีมูลค่าเพิ่ม</asp:TableCell>
                <asp:TableCell runat="server"><asp:Label ID="taxPrice" runat="server" Text="Label"></asp:Label></asp:TableCell>
                <asp:TableCell runat="server">บาท</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow runat="server">
                <asp:TableCell runat="server">มูลค่าสุทธิ</asp:TableCell>
                <asp:TableCell runat="server"><asp:Label ID="AllTotalPrice" runat="server" Text="Label"></asp:Label></asp:TableCell>
                <asp:TableCell runat="server">บาท</asp:TableCell>
            </asp:TableRow>
        </asp:Table>
        <br />
    <asp:Button ID="Button2" runat="server" Text="พิมพ์ใบเสร็จ" 
        onclick="Button2_Click" style="text-align: right; margin-left: 580px;" 
        Height="63px" Width="115px" />
    </asp:Panel>

    <p>

    <br />
</p>
    <% }
       else
       { %><asp:Label ID="ErrorText" runat="server" 
    Text="สิทธิหน้านี้สำหรับ ผู้ดูเเลระบบเท่านั้น " ForeColor="Red" 
        style="text-align: center"></asp:Label><asp:HyperLink ID="HyperLink1" 
    runat="server" NavigateUrl="http://physio10.com/" > click</asp:HyperLink><% } %>
</asp:Content>
